﻿@{
    ViewBag.Title = "产品信息";
    var product = ViewBag.Product as CubicFWNet.Data.Models.Product;
    Layout = "~/Views/Shared/_InfoPage.cshtml";
}

<section class="content">
    <form class="form-horizontal" method="post" id="formProduct">
        <div class="box box-solid">
            <div class="box-body">
                <div class="row">
                    <input type="hidden" name="ProductID" value="@product.Id" />
                    @*<input type="hidden" id="modalData" value="@product.Data">*@
                    <input type="hidden" id="Data" name="Data" />

                    @if (product.Type == 1)
                    {
                        <div class="form-group col-md-6 col-sm-12">
                            <label for="ProductName" class="col-sm-3 control-label">产品名称</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" id="ProductName" name="ProductName" value="@product.Name">
                            </div>
                        </div>

                        <div class="form-group col-md-6 col-sm-12">
                            <label for="Number" class="col-sm-3 control-label">产品编号</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" id="Number" name="Number" value="@product.Number">
                            </div>
                        </div>

                        <div class="form-group col-md-6 col-sm-12">
                            <label for="WorkType" class="col-sm-3 control-label">执行部门</label>
                            <div class="col-sm-9">
                                @if (product.ExecuteDepartment == 1)
                                {
                                    <input type="text" class="form-control" value="工厂" />
                                }
                                else if (product.ExecuteDepartment == 2)
                                {
                                    <input type="text" class="form-control" value="采购" />
                                }

                            </div>
                        </div>

                        @*<div class="form-group col-md-6 col-sm-12" >
                                <label for="Type" class="col-sm-3 control-label">加工方式</label>
                                <div class="col-sm-9">
                                    @if (product.WorkType == 1)
                                    {
                                    <input type="text" class="form-control" value="模切" />
                                    }
                                    else if (product.WorkType == 2)
                                    {
                                    <input type="text" class="form-control" value="切卷" />
                                    }
                                </div>
                            </div>*@

                        <div class="form-group col-md-6 col-sm-12" style="display:none">
                            <label for="Format" class="col-sm-3 control-label">产品规格</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" id="Format" name="Format" value="@product.Format" />
                            </div>
                        </div>

                        @*<div class="form-group col-md-6 col-sm-12">
                                <label for="Pack" class="col-sm-3 control-label">枚/张</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="Pack" name="Pack" value="@product.Pack" />
                                </div>
                            </div>*@

                        <div class="form-group col-md-6 col-sm-12">
                            <label for="Unit" class="col-sm-3 control-label">基本单位</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" id="Unit" name="Unit" value="@product.Unit" />
                            </div>
                        </div>

                        @*<div class="form-group col-md-6 col-sm-12">
                                <label for="PackRequire" class="col-sm-3 control-label">包装要求</label>
                                <div class="col-sm-9">
                                    @if (product.PackRequire == 1)
                                    {
                                        <input type="text" class="form-control" value="平张" />
                                    }
                                    else if (product.PackRequire == 2)
                                    {
                                        <input type="text" class="form-control" value="卷筒" />
                                    }
                                </div>
                            </div>*@

                        @*<div class="form-group col-md-6 col-sm-12">
                                <label for="PackAmount" class="col-sm-3 control-label">包装数量</label>
                                <div class="col-sm-9">
                                    <input type="number" class="form-control" id="PackAmount" name="PackAmount" value="@product.PackAmount"  />
                                </div>
                            </div>*@

                        <div class="form-group col-md-6 col-sm-12">
                            <label for="Width" class="col-sm-3 control-label">宽度-mm</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" id="Width" name="Width" value="@product.SizeWidth" />
                            </div>
                        </div>

                        <div class="form-group col-md-6 col-sm-12">
                            <label for="Length" class="col-sm-3 control-label">长度-mm</label>
                            <div class="col-sm-9">
                                <input type="number" class="form-control" id="Length" name="Length" value="@product.SizeLenth" />
                            </div>
                        </div>

                        <div class="form-group col-md-6 col-sm-12">
                            <label for="Price" class="col-sm-3 control-label">内部价格</label>
                            <div class="col-sm-9">
                                <input type="number" class="form-control" id="Price" name="Price" value="@product.Price" />
                            </div>
                        </div>

                        @*<div id="json-content">
                                <div class="form-group col-md-6 col-sm-12" style="display:none">
                                    <label for="Quantity" class="col-sm-3 control-label">起订量[PCS]</label>
                                    <div class="col-sm-9">
                                        <input type="number" class="form-control" id="Quantity" name="Quantity" data-des="起订量[PCS]" value="@product.Quantity" />
                                    </div>
                                </div>
                                <div class="form-group col-md-6 col-sm-12">
                                    <label for="Color" class="col-sm-3 control-label">颜色</label>
                                    <div class="col-sm-9">
                                        <input type="text" class="form-control" id="Color" name="Color" data-des="颜色" maxlength="50" value="@product.Color" />
                                    </div>
                                </div>
                                <div class="form-group col-md-6 col-sm-12">
                                    <label for="Angel" class="col-sm-3 control-label">角度</label>
                                    <div class="col-sm-9">
                                        <input type="number" class="form-control" id="Angel" name="Angel" data-des="角度" value="@product.Angel" />
                                    </div>
                                </div>
                                <div class="form-group col-md-6 col-sm-12">
                                    <label for="Tolerance" class="col-sm-3 control-label">正公差-mm</label>
                                    <div class="col-sm-9">
                                        <input type="number" class="form-control" id="Tolerance" name="Tolerance" data-des="公差-mm" value="@product.Tolerance" />
                                    </div>
                                </div>
                                <div class="form-group col-md-6 col-sm-12">
                                    <label for="ToleranceMinus" class="col-sm-3 control-label">负公差-mm</label>
                                    <div class="col-sm-9">
                                        <input type="number" class="form-control" id="ToleranceMinus" name="ToleranceMinus" data-des="公差-mm" value="@product.ToleranceMinus" />
                                    </div>
                                </div>
                                <div class="form-group col-md-6 col-sm-12">
                                    <label for="Space" class="col-sm-3 control-label">左右间距-mm</label>
                                    <div class="col-sm-9">
                                        <input type="number" class="form-control" id="Space" name="Space" data-des="左右间距-mm" value="@product.Space" />
                                    </div>
                                </div>
                                <div class="form-group col-md-6 col-sm-12">
                                    <label for="Margin" class="col-sm-3 control-label">左右边距-mm</label>
                                    <div class="col-sm-9">
                                        <input type="number" class="form-control" id="Margin" name="Margin" data-des="左右边距-mm" value="@product.Margin" />
                                    </div>
                                </div>
                                <div class="form-group col-md-6 col-sm-12">
                                    <label for="Distance" class="col-sm-3 control-label">跳距-mm</label>
                                    <div class="col-sm-9">
                                        <input type="number" class="form-control" id="Distance" name="Distance" data-des="跳距-mm" value="@product.Distance" />
                                    </div>
                                </div>
                            </div>*@
                    }
                    //else if (product.Type == 2 || product.Type == 3)
                    else
                    {
                        <div class="form-group col-md-6 col-sm-12">
                            <label for="ProductName" class="col-sm-3 control-label">原料名称</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" id="ProductName" name="ProductName" value="@product.Name">
                            </div>
                        </div>

                        <div class="form-group col-md-6 col-sm-12">
                            <label for="Number" class="col-sm-3 control-label">原料编号</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" id="Number" name="Number" value="@product.Number">
                            </div>
                        </div>
                        @*<div class="form-group col-md-6 col-sm-12">
                                <label for="Pack" class="col-sm-3 control-label">包装单位</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="Pack" name="Pack" value="@product.Pack" />
                                </div>
                            </div>*@
                        <div class="form-group col-md-6 col-sm-12">
                            <label for="Unit" class="col-sm-3 control-label">基本单位</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" id="Unit" name="Unit" value="@product.Unit" />
                            </div>
                        </div>

                        <div class="form-group col-md-6 col-sm-12">
                            <label for="Width" class="col-sm-3 control-label">宽度-mm</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" id="Width" name="Width" value="@product.SizeWidth" />
                            </div>
                        </div>

                        <div class="form-group col-md-6 col-sm-12">
                            <label for="Length" class="col-sm-3 control-label">长度-mm</label>
                            <div class="col-sm-9">
                                <input type="number" class="form-control" id="Length" name="Length" value="@product.SizeLenth" />
                            </div>
                        </div>
                        @*if (product.Type == 2)
                            {
                                <div class="form-group col-md-6 col-sm-12">
                                    <label for="Price" class="col-sm-3 control-label">价格-元/平米</label>
                                    <div class="col-sm-9">
                                        <input type="number" class="form-control" id="Price" name="Price" value="@product.Price" />
                                    </div>
                                </div>
                            }
                            else if (product.Type == 3)
                            {
                                <div class="form-group col-md-6 col-sm-12">
                                    <label for="Price" class="col-sm-3 control-label">价格-元/基本单位</label>
                                    <div class="col-sm-9">
                                        <input type="number" class="form-control" id="Price" name="Price" value="@product.Price" />
                                    </div>
                                </div>
                            }
                            <div class="form-group col-md-6 col-sm-12">
                                <label for="Color" class="col-sm-3 control-label">颜色</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="Color" name="Color" data-des="颜色" maxlength="50" value="@product.Color" />
                                </div>
                            </div>*@
                    }

                </div>
                <div class="row" style="display:none">
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Status" class="col-sm-3 control-label">状态</label>
                        <div class="col-sm-9">
                            <span class="form-control" style="border:none">
                                @if (product.Status == 1)
                                {
                                    <span class="btn-xs bg-green">正常</span>
                                }
                                else
                                {
                                    <span class="btn-xs bg-black">禁用</span>
                                }
                            </span>
                        </div>
                    </div>
                </div>

                @*<div class="row">
                        <div class="form-group col-md-6 col-sm-12">
                            <label for="Explain" class="col-sm-3 control-label">特点</label>
                            <div class="col-sm-9">
                                <textarea rows="3" class="form-control" id="Explain" name="Explain" maxlength="500" readonly="readonly">@product.Explain</textarea>
                            </div>
                        </div>
                        <div class="form-group col-md-6 col-sm-12">
                            <label for="Memo" class="col-sm-3 control-label">备注</label>
                            <div class="col-sm-9">
                                <textarea rows="3" class="form-control" id="Memo" name="Memo" readonly="readonly">@product.Memo</textarea>
                            </div>
                        </div>
                    </div>*@

                <div class="row">
                    @*<div class="form-group col-md-6 col-sm-12">
                            <label for="Creator" class="col-sm-3 control-label">创建人</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" id="Creator" name="Tolerance" value="@product.CreatorName" readonly="readonly" />
                            </div>
                        </div>*@
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="CreateTime" class="col-sm-3 control-label">创建时间</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="CreateTime" value="@product.CreateTime" readonly="readonly" />
                        </div>
                    </div>
                </div>
                <table class="footable table table-stripped table-bordered table-hover" id="footable" data-page-size="20" data-filter=#filter>
                    <thead>
                        <tr>
                            <th data-sort-ignore="true">
                                日期
                            </th>

                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                备注
                            </th>
                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                日志
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @if (null != @ViewBag.TakeLogs)
                        {
                            foreach (var item in @ViewBag.TakeLogs)
                            {
                                <tr>
                                    <td>
                                        @item.Creation
                                    </td>
                                    <td>
                                        @item.Memo
                                    </td>
                                    <td>
                                        @item.Comment
                                    </td>
                                </tr>
                            }
                        }
                    </tbody>
                </table>
            </div>
        </div>
    </form>
</section>
@section Scripts {
    <script type="text/javascript">
        $(document).ready(function () {
            //解析Data数据
            //var data = JSON.parse(document.getElementById("modalData").value);
            //var $content = $('#json-content');
            //var html = "";
            //data.forEach(function (e, i) {
            //    if (typeof e.value == "undefined") {
            //        e.value = "";
            //    }
            //    if (typeof e.name == "undefined") {
            //        e.name = "";
            //    }
            //    if (typeof e.des == "undefined") {
            //        e.des = "未知";
            //    }
            //    html += "<div class='form-group col-md-6'>";
            //    html += "<label for='j_a' class='col-sm-3 control-label'>" + e.des + "</label>";
            //    html += "<div class='col-sm-9'>";
            //    html += "<input type='text' class='form-control' data-des='" + e.des + "' id='" + e.name + "' name='" + e.name + "' value='" + e.value + "'  readonly>";
            //    html += "</div></div>";
            //});
            //$content.append(html);

            //禁用input
            $("input").prop("readonly", "readonly");
        })
    </script>
}